<template>
  <a-card  title="基本信息" style="width: 100%" v-if="userInfo==='student'">
<!--    <template #extra><a href="#">修改</a></template>-->
    <p>姓名:  {{userDate?.studentName}}</p>
    <p>性别: {{userDate?.studentGender}}</p>
    <p>家庭住址:  {{userDate?.studentAddress}}</p>
    <p>出生年月:  {{userDate?.studentBirthdate}}</p>
    <p>专业:  {{userDate?.studentMajor}}</p>
    <p>级号:  {{userDate?.studentClassNo}}</p>
    <p>学制:  {{userDate?.studentAcademicDuration}}</p>
    <p>状态:  {{userDate?.studentStatus===1?'在校':'离校'}}</p>
    <p>入学时间:  {{dayjs(userDate?.createTime).format('YYYY-MM-DD')}}</p>
  </a-card>

  <a-card title="基本信息" style="width: 100%" v-if="userInfo==='teacher'">
<!--    <template #extra><a href="#">修改</a></template>-->
    <p>姓 名:  {{userDate?.teacherName}}</p>
    <p>性 别:  {{userDate?.teacherGender}}</p>
    <p>住 址:  {{userDate?.teacherAddress}}</p>
    <p>生 日:  {{userDate?.teacherBirthdate}}</p>
    <p>院 系:  {{userDate?.teacherDeptname}}</p>
    <p>入职时间:  {{ dayjs(userDate?.createTime).format('YYYY-MM-DD')}}</p>
    <p>状 态:  {{userDate?.teacherStatus===1?'在校':'离校'}}</p>
    <p>备 注:  {{userDate?.teacherRemarks}}</p>
<!--    <p>入学时间:{{teacherDate?.studentEnrollmentDate}}</p>-->
  </a-card>

    <a-card title="基本信息" style="width: 100%" v-if="userInfo==='admin'">
        <!--    <template #extra><a href="#">修改</a></template>-->
        <p>姓 名:  {{userDate?.adminName}}</p>
        <p>性 别:  {{userDate?.adminGender}}</p>
        <p>住 址:  {{userDate?.adminAddress}}</p>
        <p>生 日:  {{userDate?.adminBirthdate}}</p>
        <p>院 系:  {{userDate?.adminDeptname}}</p>
        <p>入职时间:  {{ dayjs(userDate?.adminDate).format('YYYY-MM-DD')}}</p>
        <p>状 态:  {{userDate?.adminStatus===1?'在校':'离校'}}</p>
        <p>备 注:  {{userDate?.adminRemarks}}</p>
        <!--    <p>入学时间:{{teacherDate?.studentEnrollmentDate}}</p>-->
    </a-card>
</template>

<script setup lang="ts">


import {onMounted, ref} from "vue";
import myAxios from "../plugins/myAxios";
import {useRouter} from "vue-router";
import dayjs from "dayjs";
const router = useRouter()
// const studentDate = ref()
const userDate = ref()

const userInfo = ref()


//获取用户信息
const getUser = async () => {
  const user = await myAxios.get("/user/get/permissions")
  if (user.data){
    userInfo.value =user.data
  }else {
    await router.push({path: '/'})
  }
}

const getUserinfo = async () => {
  const user = await myAxios.get("/user/get/logininfo")
  if (user.data){
    userDate.value =user.data
  }else {
    // await router.push({path: '/'})
  }
}
onMounted(()=>{
  getUser()
  getUserinfo()
})
</script>

<style scoped>

</style>